<?php

class CategoryModel extends BaseModel {
	
	
	public function getCategoryList($parent_id = 0,$default_id=0){
		$sql = "select cat_id,cat_name from ecs_category where parent_id=".$parent_id;
		$list =  $this->db->getAll($sql);
		if($default_id){
			foreach($list as &$row){
				if($row["cat_id"] == $default_id){
					$row["isred"] = 1;
				}else{
					$row["isred"] = 0;
				}
			}
		}
		return $list;
	}
}